package com.kushe.site.form;

import org.jreform.HtmlForm;

import static org.jreform.criteria.Criteria.length;
import static org.jreform.criteria.Criteria.range;

/**
 * Created by WhiteBlue on 15/4/3.
 */
public class DesignForm extends HtmlForm {
    public DesignForm() {
        input(stringType(), "title", length(1, 20));
        input(stringType(), "content", length(1, 200));
        input(doubleType(), "price");
        input(intType(), "sort", range(0, 1000));
        input(intType(), "min", range(10, 1000));
        input(intType(), "max", range(100, 2000));
    }

    public String getTitle() {
        return (String) getInput("title").getValue();
    }

    public String getContent() {
        return (String) getInput("content").getValue();
    }

    public double getPrice() {
        return (Double) getInput("price").getValue();
    }

    public int getSort() {
        return (Integer) getInput("sort").getValue();
    }

    public int getMin() {
        return (Integer) getInput("min").getValue();
    }

    public int getMax() {
        return (Integer) getInput("max").getValue();
    }
}
